package edu.ncsu.csc.itrust.bean;

import junit.framework.TestCase;
import edu.ncsu.csc.itrust.beans.MessageBean;

/**
 * JUnit Test for Bug #4 HW2P2
 * @author stbowen & pjfinega
 *
 */
public class MessageBeanTest extends TestCase {

	MessageBean msg1 = new MessageBean();
	MessageBean msg2 = new MessageBean();
		
	/**
	 * Setup for independent testing
	 */
	public void setUp(){
		
		msg1.setTo(1);
		msg1.setMessageId(345);
		msg1.setFrom(2);
		msg1.setSubject("Hey! Listen!");
		msg1.setBody("Lorem Ipsum");
		msg1.setRead(0);
		
		msg2.setTo(2);
		msg2.setMessageId(567);
		msg2.setFrom(1);
		msg2.setSubject("Watch Out!");
		msg2.setBody("Lorem Ipsum");
		msg2.setRead(1);
		
	}
	
	public void testGetSetRead(){
		
		setUp();
		
		assertEquals( msg1.getRead(), 0);
		assertEquals( msg2.getRead(), 1);
		
		msg1.setRead(1);
		msg2.setRead(0);
		
		assertEquals( msg1.getRead(), 1);
		assertEquals( msg2.getRead(), 0);
		
	}
	
}
